<template>
  <div>
    <city-Header> </city-Header>
    <city-Search> </city-Search>
    <city-List :city="city" :cities="cities" :hot="hotCities"></city-List>
    <city-Alphabet :cities="cities"> </city-Alphabet>
  </div>
</template>
<script>
import CityHeader from "./components/Header";
import CitySearch from "./components/Search";
import CityList from "./components/List";
import CityAlphabet from "./components/Alphabet";
import axios from "axios";
export default {
  name: "City",
  components: {
    CityHeader,
    CitySearch,
    CityList,
    CityAlphabet,
  },
  data() {
    return {
      city: "",
      hotCities: [],
      cities: {}
    };
    
  },
  methods: {
    getCityInfo() {
      axios.get("/api/city.json").then(this.getCityInfoSucc);
    },
    getCityInfoSucc(res) {
      res = res.data;
      if (res.ret && res.data) {
        const data = res.data;
        this.city = data.city;
        this.hotCities = data.hotCities;
        this.cities = data.cities;
      }
    },
  },
  mounted() {
    this.getCityInfo();
  },
};
</script>
<style scoped>
</style>